package com.itheima.test2;

import jdk.swing.interop.SwingInterOpUtils;

import java.math.BigDecimal;

public class Test2BigDecimalDemo2 {
    public static void main(String[] args) {
        BigDecimal bd1 = new BigDecimal("0.1");
        BigDecimal bd2 = new BigDecimal("0.3");
        //BigDecimal divide = bd1.divide(bd2);
        //System.out.println(divide);
        //参数一:表示参数运算的另一个对象
        //参数二:表示保留小数点后精确到多少位
        //参数三:舍入模式:
                //进一法
                //去尾法:
                //四舍五入法:
        BigDecimal divide1 = bd1.divide(bd2, 2, BigDecimal.ROUND_UP);
        System.out.println(divide1);
        BigDecimal divide2 = bd1.divide(bd2, 2, BigDecimal.ROUND_FLOOR);
        System.out.println(divide2);
        BigDecimal divide3 = bd1.divide(bd2, 2, BigDecimal.ROUND_HALF_UP);
        System.out.println(divide3);
    }
}


